Fix bug in target lookup
authorRyan Quattlebaum <ryan.quattlebaum@icloud.com>
Mon, 14 Mar 2016 19:00:58 +0000 (15:00 -0400)
committerRyan Quattlebaum <ryan.quattlebaum@icloud.com>
Mon, 14 Mar 2016 19:00:58 +0000 (15:00 -0400)
The target lookup used to only look for bin targets, but now looks for
targets with the correct type.

src/cargo/ops/cargo_compile.rs

index d5eb7ec09f2be8d3c3b0cef5aa714dd4febb25a7..1658a1a1bec5f81b5e1952989eafbf564de90106 100644 (file)
@@ -143,7 +143,7 @@ fn validate_target(package: &Package,
                    kind: TargetKind,
                    kind_str: &str) -> CargoResult<()> {
     let target = package.targets().iter().find(|t: &&Target| {
-        t.name() == name && *t.kind() == TargetKind::Bin
+        t.name() == name && *t.kind() == kind
     });
     if target.is_none() {
         let suggestion = package.find_closest_target(name, kind);